//
//  TRAboutUsViewController.m
//  WeiMiLan
//
//  Created by Mac on 14-7-20.
//  Copyright (c) 2014年 Mac. All rights reserved.
//

#import "TRAboutUsViewController.h"

@interface TRAboutUsViewController ()
@property (strong, nonatomic) IBOutlet UIWebView *myWebview;

@end

@implementation TRAboutUsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.delegate=ApplicationDelegate;
    // Do any additional setup after loading the view.
    [self initNavigation];
    NSURL *myUrl=[NSURL URLWithString:@"http://www.vsmu.cn/gy.html"];
    [self.myWebview loadRequest:[[NSURLRequest alloc] initWithURL:myUrl]];
    
    
    NSString * adURL = [MobClick getAdURL];
    
    NSLog(@"string:%@",adURL);
    adURL =[adURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL * url=[NSURL URLWithString:adURL];
    
    
    
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
    
   // self.webView.bottom=self.weChatNavigationBar.bottom;
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    self.versionLabel.text=[NSString stringWithFormat:@"当前版本号：%@",app_Version];
    
}

- (void)initNavigation
{
    [self.navigationController setNavigationBarHidden:YES animated:YES];
   // self.view.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"main_bg"]];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.weChatNavigationBar=[[WeChatNavigationBar alloc] init];
    [self.view addSubview:self.weChatNavigationBar];
    self.weChatNavigationBar.titleLabel.text=@"关于我们";
    //[self.weChatNavigationBar.rightButton setImage:nil forState:0];
    [self.weChatNavigationBar .leftButton addTarget:self action:@selector(exit)  forControlEvents:UIControlEventTouchUpInside];
    
    self.weChatNavigationBar.rightButton.frame=CGRectMake(266,27,40,25);
    [self.weChatNavigationBar.rightButton setImage:nil forState:0];
    [self.weChatNavigationBar.rightButton setTitle:@"推荐" forState:0];
    
    [self.weChatNavigationBar.rightButton addTarget:self action:@selector(toAdd) forControlEvents:UIControlEventTouchUpInside];
}
-(void)exit
{
    
    [self.navigationController popViewControllerAnimated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(void)toAdd
{

    [self performSegueWithIdentifier:@"toadd" sender:nil];

}

- (IBAction)shareAppAction:(id)sender
{
    [self.delegate changeScene:0];
    [self.delegate sendAppLinkContent];
}
@end
